<template>
	<div class="box">
		<h2>消息提示</h2>
		<button @click="open1">显示info信息</button>
		<button @click="open2">显示success信息,带关闭按钮</button>
		<button @click="open3($event)">显示warning信息（改变现实位置）</button>
		<button @click="open4">显示error信息</button>
	</div>
</template>

<script>
export default {
  name: "Index",
  data() {
    return {};
  },
  methods: {
    open1() {
      this.$my_message("这是一个message", "info");
    },
    open2() {
      this.$my_message({
        content: "这是一个success提示",
        time: 5000000,
        type: "success",
        hasClose: true
      });
    },
    open3(event) {
      //this.$my_message('这是一个warning','warning');

      let e = event || window.event,
        top = e.clientY - 60,
        left = e.clientX - 30;
      this.$my_message({
        content: "这是一个warning!",
        type: "warning",
        top: top + "px",
        left: left + "px"
      });
    },
    open4() {
      this.$my_message({
        content: "这是一个error",
        type: "error"
      });
    }
  }
};
</script>
